this.actor.add(this._topBox,
{ row: 0, col: 0, col_span: offsetCols + 7 });
- let back = new St.Button({ style_class: 'calendar-change-month-back',
- can_focus: true });
- this._topBox.add(back);
- back.connect('clicked', Lang.bind(this, this._onPrevMonthButtonClicked));
+ this._backButton = new St.Button({ style_class: 'calendar-change-month-back',
+ can_focus: true });
+ this._topBox.add(this._backButton);
+ this._backButton.connect('clicked', Lang.bind(this, this._onPrevMonthButtonClicked));
this._monthLabel = new St.Label({style_class: 'calendar-month-label'});
this._topBox.add(this._monthLabel, { expand: true, x_fill: false, x_align: St.Align.MIDDLE });
- let forward = new St.Button({ style_class: 'calendar-change-month-forward',
- can_focus: true });
- this._topBox.add(forward);
- forward.connect('clicked', Lang.bind(this, this._onNextMonthButtonClicked));
+ this._forwardButton = new St.Button({ style_class: 'calendar-change-month-forward',
+ can_focus: true });
+ this._topBox.add(this._forwardButton);
+ this._forwardButton.connect('clicked', Lang.bind(this, this._onNextMonthButtonClicked));
// Add weekday labels...
//
}
}
+ this._backButton.grab_key_focus();
+
this.setDate(newDate, false);
- },
+ },
- _onNextMonthButtonClicked: function() {
+ _onNextMonthButtonClicked: function() {
let newDate = new Date(this._selectedDate);
let oldMonth = newDate.getMonth();
if (oldMonth == 11) {
}
}
- this.setDate(newDate, false);
+ this._forwardButton.grab_key_focus();
+
+ this.setDate(newDate, false);
},
_onSettingsChange: function() {
let iterStr = iter.toUTCString();
button.connect('clicked', Lang.bind(this, function() {
+ this._shouldDateGrabFocus = true;
+
let newlySelectedDate = new Date(iterStr);
this.setDate(newlySelectedDate, false);
+
+ this._shouldDateGrabFocus = false;
}));
let hasEvents = this._eventSource.hasEvents(iter);
else if (iter.getMonth() != this._selectedDate.getMonth())
styleClass += ' calendar-other-month-day';
- if (_sameDay(this._selectedDate, iter))
- button.add_style_pseudo_class('active');
-
if (hasEvents)
styleClass += ' calendar-day-with-events'
this.actor.add(button,
{ row: row, col: offsetCols + (7 + iter.getDay() - this._weekStart) % 7 });
+ if (_sameDay(this._selectedDate, iter)) {
+ button.add_style_pseudo_class('active');
+
+ if (this._shouldDateGrabFocus)
+ button.grab_key_focus();
+ }
+
if (this._useWeekdate && iter.getDay() == 4) {
let label = new St.Label({ text: _getCalendarWeekForDate(iter).toString(),
style_class: 'calendar-day-base calendar-week-number'});